package com.atguigu.day12.Test04;

public class Test04 {
    public static void main(String[] args) {
        Worker w1 = new Worker();
        Worker w2 = new Worker();
        Apple a1 = new Apple(5,"青色");
        Apple a2 = new Apple(3,"红色");
        w1.pickApple(new CompareBig(){

        },a1,a2);
        w2.pickApple(new CompareColor(){
            @Override
            public Apple compare(Apple a, Apple b) {
                System.out.println("挑红的：");
                if ("红色".equals(a.getColor())) {
                    System.out.println(a.getSize() + "-" + a.getColor());
                    return a;
                }
                if ("红色".equals(b.getColor())) {
                    System.out.println(b.getSize() + "-" + b.getColor());
                    return b;
                } else
                    return null;
            }
        },a1,a2);
        //w2.pickApple(new CompareColor(),a1,a2);
    }
}
